<template>
	<div class="train-teacher-statistics maxW">
		<div class="crumbs-link">
			<span @click="goback()">培训列表</span>
			<router-link to="/train/manage/index"><i>></i>培训管理</router-link>
			<strong v-if="name"><i>></i>{{name}}统计</strong>
			<strong v-else><i>></i>教师培训统计</strong>
		</div>

		<div class="train-teacher-statistics-wp">
			<div class="train-teacher-statistics-title">
				<span>{{name !== '' ? name : '教师培训'}}</span>
			</div>
			<div class="train-teacher-statistics-content" v-loading="loading">
				<p>学分细明</p>
				<template>
					<el-table
					border
					:data="teacher_list"
					style="width: 100%">
						<el-table-column
							type="index"
							label="序号"
							width="50"
							align="center">
						</el-table-column>
						<el-table-column
						prop="name"
						label="用户名"
						width=""
						show-overflow-tooltip>
						</el-table-column>
						<el-table-column
						prop="number"
						label="用户账号"
						width=""
						show-overflow-tooltip>
						</el-table-column>
						<el-table-column
						prop="position_name"
						label="地区"
						width=""
						show-overflow-tooltip>
						</el-table-column>
						<el-table-column
						prop="school_name"
						label="学校"
						width=""
						show-overflow-tooltip>
						</el-table-column>
						<el-table-column
						prop="study_section_name"
						label="学段"
						align="center"
						show-overflow-tooltip>
						</el-table-column>
						<el-table-column
						prop="subject_name"
						label="科目"
						width=""
						align="center"
						show-overflow-tooltip>
						</el-table-column>
						<el-table-column
						prop="create_time"
						label="最后学习时间"
						width=""
						show-overflow-tooltip>
						</el-table-column>
						<el-table-column
						prop="study_score"
						label="获得学分"
						width=""
						align="center"
						show-overflow-tooltip>
						</el-table-column>
					</el-table>
				</template>

				<el-pagination
				 	 background
				 	v-if="total_number > page_size"
				 	 class="pageing"
				     @size-change="sizeChange"
				     @current-change="currentChange"
				     :current-page="page_index"
				     :page-size="page_size"
				     layout="total, prev, pager, next, jumper"
				     :total="total_number">
				</el-pagination>
			</div>

			<div class="dependent" v-if="placeholder">
				<i class="ipng image_state01"></i>
				<p>还没发现任何相关的内容哦~</p>
			</div>
		</div>
	</div>
</template>

<script>

	
	export default{
		data() {
			return {
				page_size: this.$g.page_size,
				page_index: 1,
				total_number: 0,
				placeholder: false,
				loading: true,
				teacher_list: [],
				name: this.$route.query.name
			}
		},
		created(){

			this.get_trainLset()
		},
		methods: {
			get_trainLset(){
				let success = (res =>{
					let data = res.data;
					this.teacher_list = data.data;
					this.total_number = parseInt(data.data_sum);

					this.loading = false

					this.teacher_list.length === 0
					? this.placeholder = true
					: this.placeholder = false
				});

				this.$ajax({
					url: 'api/Train/train_static_data',
					method: 'get',
					params: {
						train_id: this.$route.query.trainid,
						page_size: this.page_size,
						page_index: this.page_index
					},
					func: {success: success}
				})
			},
			goback(){
				this.$router.back(-1)
			},
			sizeChange(val) {
				this.page_size = val;
				this.get_trainLset()
			},
			currentChange(val) {
				this.page_index = val;
				this.get_trainLset()
			},
		}
	}
</script>